#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
void InsertStr(char* arr1, char* arr2, int a)
{
	int sz1 = strlen(arr1);
	int sz2 = strlen(arr2);
	int i = 0;
	for (i =0;i<=sz1-a;i++)
	{
		*(arr1 + sz1 - 1 - i + sz2) = *(arr1 + sz1 - 1 - i);
	}
	int j = 0;
	for (i = a - 1, j = 0; j < sz2; j++, i++)
	{
		*(arr1 + i) = *(arr2 + j); 
	}
}
int main()
{
	char arr1[30]="0";
	char arr2[10]="0";
	int a = 0;
	gets(arr1);
	gets(arr2);
	scanf("%d", &a);
	InsertStr(arr1, arr2, a);
	int i = 0;
	for (i = 0; *(arr1 + i); i++)
	{
		printf("%c", *(arr1 + i));
	}
	return 0;
}